package com.bos.utils;

import com.bos.domain.User;
import com.google.inject.internal.util.$Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author Administrator
 */
@Component
public class BOSUtil {

    private static HttpServletRequest request=null;

    public BOSUtil(){}

    @Autowired
    public BOSUtil( HttpServletRequest request){
        BOSUtil.request=request;
    }

    public  static User getUser(){
        return (User) request.getSession().getAttribute("user");
    }

    public  static HttpSession getSession(){
        return  request.getSession();
    }

    public  static HttpServletRequest getRequest(){
        return  request;
    }


}
